/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import type.Month;
import type.ProductionType;
import type.SalesForecastPeriodType;

/**
 *
 * @author wei
 */
@Entity(name="MasterProductionScheduleMonthly")
public class MasterProductionScheduleMonthlyEntity extends DataObjectEntity implements Serializable {
    private int yearOfProduction;
    private Month monthOfProduction;
    
    @OneToOne
    private SalesForecastEntity salesForecast;
    private long fulfilledFigure;
    private long salesForecastFigure;
    private SalesForecastPeriodType type;
    
    private long plannedQuantity;
    private long classicNuts;
    private long classicFruits;
    private long premiumNuts;
    private long premiumFruits;
    
    private long reservedClassicNuts;
    private long reservedClassicFruits;
    private long reservedPremiumNuts;
    private long reservedPremiumFruits;
    
    private long safetyStock;
    private long monthlyWorkingDays;
    
    private double capacityNormal;
    private double capacityOverTime;
    private double utilizationNormal;
    private double utilizationOverTime;
    private ProductionType productionType;
    
    @OneToMany(cascade={CascadeType.ALL}, mappedBy="mpsMonthly")
    private Collection<ProductPercentageQuantityEntity> plannedPPQ = new ArrayList<ProductPercentageQuantityEntity>();
    
    @OneToMany(cascade={CascadeType.ALL})
    private Collection<ProductPercentageQuantityEntity> overallPPQ = new ArrayList<ProductPercentageQuantityEntity>();
    
    @OneToMany //make it uni directional for now - from monthly cannot get to weekly
    private Collection<MasterProductionScheduleWeeklyEntity> mpsWeekly = new ArrayList<MasterProductionScheduleWeeklyEntity>();
    
    @OneToMany(cascade={CascadeType.ALL}, mappedBy="mpsMonthly")
    private Collection<MasterProductionScheduleDailyEntity> mpsDaily = new ArrayList<MasterProductionScheduleDailyEntity>();

    public MasterProductionScheduleMonthlyEntity() {
        super();
    }

    public long getReservedClassicFruits() {
        return reservedClassicFruits;
    }

    public void setReservedClassicFruits(long reservedClassicFruits) {
        this.reservedClassicFruits = reservedClassicFruits;
    }

    public long getReservedClassicNuts() {
        return reservedClassicNuts;
    }

    public void setReservedClassicNuts(long reservedClassicNuts) {
        this.reservedClassicNuts = reservedClassicNuts;
    }

    public long getReservedPremiumFruits() {
        return reservedPremiumFruits;
    }

    public void setReservedPremiumFruits(long reservedPremiumFruits) {
        this.reservedPremiumFruits = reservedPremiumFruits;
    }

    public long getReservedPremiumNuts() {
        return reservedPremiumNuts;
    }

    public void setReservedPremiumNuts(long reservedPremiumNuts) {
        this.reservedPremiumNuts = reservedPremiumNuts;
    }

    public void setProductionType(ProductionType type){
        productionType = type;
    }

    public ProductionType getProductionType(){
        return productionType;
    }

    public double getCapacityNormal() {
        return capacityNormal;
    }

    public void setCapacityNormal(double capacityNormal) {
        this.capacityNormal = capacityNormal;
    }

    public double getCapacityOverTime() {
        return capacityOverTime;
    }

    public void setCapacityOverTime(double capacityOverTime) {
        this.capacityOverTime = capacityOverTime;
    }

    public Month getMonthOfProduction() {
        return monthOfProduction;
    }

    public void setMonthOfProduction(Month monthOfProduction) {
        this.monthOfProduction = monthOfProduction;
    }

    public long getMonthlyWorkingDays() {
        return monthlyWorkingDays;
    }

    public void setMonthlyWorkingDays(long monthlyWorkingDays) {
        this.monthlyWorkingDays = monthlyWorkingDays;
    }

    public Collection<ProductPercentageQuantityEntity> getPlannedPPQ() {
        return plannedPPQ;
    }

    public void setPlannedPPQ(Collection<ProductPercentageQuantityEntity> plannedPPQ) {
        this.plannedPPQ = plannedPPQ;
    }

    public long getPlannedQuantity() {
        return plannedQuantity;
    }

    public void setPlannedQuantity(long quantity) {
        this.plannedQuantity = quantity;
    }
    
    public void changePlannedQuantity() {
        this.plannedQuantity = this.classicNuts + this.classicFruits + this.premiumNuts + this.premiumFruits;
    }

    public long getSafetyStock() {
        return safetyStock;
    }

    public void setSafetyStock(long saftyStock) {
        this.safetyStock = saftyStock;
    }

    public SalesForecastEntity getSalesForecast() {
        return salesForecast;
    }

    public void setSalesForecast(SalesForecastEntity salesForecast) {
        this.salesForecast = salesForecast;
    }

    public double getUtilizationOverTime() {
        return utilizationOverTime;
    }

    public void setUtilizationOverTime(double utilizationOverTime) {
        this.utilizationOverTime = utilizationOverTime;
    }

    public double getUtilizationNormal() {
        return utilizationNormal;
    }

    public void setUtilizationNormal(double utitlizationNormal) {
        this.utilizationNormal = utitlizationNormal;
    }

    public int getYearOfProduction() {
        return yearOfProduction;
    }

    public void setYearOfProduction(int yearOfProduction) {
        this.yearOfProduction = yearOfProduction;
    }

    public Collection<MasterProductionScheduleDailyEntity> getMpsDaily() {
        return mpsDaily;
    }

    public void setMpsDaily(Collection<MasterProductionScheduleDailyEntity> mpsDaily) {
        this.mpsDaily = mpsDaily;
    }

    public Collection<MasterProductionScheduleWeeklyEntity> getMpsWeekly() {
        return mpsWeekly;
    }

    public void setMpsWeekly(Collection<MasterProductionScheduleWeeklyEntity> mpsWeekly) {
        this.mpsWeekly = mpsWeekly;
    }

    @Override
    public String childToString() {
        return "MasterProductionScheduleMonthlyEntity{" + "yearOfProduction=" + yearOfProduction + ", monthOfProduction=" + monthOfProduction + ", salesForecast=" + salesForecast + ", plannedQuantity=" + plannedQuantity + ", saftyStock=" + safetyStock + ", monthlyWorkingDays=" + monthlyWorkingDays + ", capacityNormal=" + capacityNormal + ", capacityOverTime=" + capacityOverTime + ", utitlizationNormal=" + utilizationNormal + ", utilizationOverTime=" + utilizationOverTime + ", plannedPPQ=" + plannedPPQ + ", mpsWeekly=" + mpsWeekly + ", mpsDaily=" + mpsDaily + '}';
    }

    public long getSalesForecastFigure() {
        return getSalesForecast().getForecast();
    }

    public void setSalesForecastFigure(long salesForecastFigure) {
        this.salesForecastFigure = salesForecastFigure;
    }

    public SalesForecastPeriodType getType() {
        return type;
    }

    public void setType(SalesForecastPeriodType type) {
        this.type = type;
    }

    public long getClassicNuts() {
        return classicNuts;
    }

    public void setClassicNuts(long classicNuts) {
        this.classicNuts = classicNuts;
    }

    public long getClassicFruits() {
        return classicFruits;
    }

    public void setClassicFruits(long classicFruits) {
        this.classicFruits = classicFruits;
    }

    public long getPremiumNuts() {
        return premiumNuts;
    }

    public void setPremiumNuts(long premiumNuts) {
        this.premiumNuts = premiumNuts;
    }

    public long getPremiumFruits() {
        return premiumFruits;
    }

    public void setPremiumFruits(long premiumFruits) {
        this.premiumFruits = premiumFruits;
    }

    public long getFulfilledFigure() {
        return fulfilledFigure;
    }

    public void setFulfilledFigure(long fulfilledFigure) {
        this.fulfilledFigure = fulfilledFigure;
    }

    public Collection<ProductPercentageQuantityEntity> getOverallPPQ() {
        return overallPPQ;
    }

    public void setOverallPPQ(Collection<ProductPercentageQuantityEntity> overallPPQ) {
        this.overallPPQ = overallPPQ;
    }
    
}
